'use strict';

var s = 'Hello';

function greet(name) {
    console.log(s + ', ' + name + '!');
}

function respect(name){
    console.log('Respect, '+ name + '!');
}


module.exports = {
    respect: respect,
    greet: greet
};
//导入http模块
var http = require('http');
//创建http:server,并传入回调函数
var server = http.createServer(function(request,response){
    //回调函数接收request和response对象
    console.log(request.method+':'+request.url);
    //获取http请求的method和url
    //将http响应200写入response,同时设置内容类型
    response.writeHead(200,{'Content-Type':'text/html'});
    //将http响应的html内容写入response
    response.end('<hl>Hello.World!</hl>');
});

server.listen(8080);
console.log('Sever is running at http://127.0.0.1:8080/');